package com.zijie.shoprbacapi.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.injector.methods.SelectPage;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zijie.rbac.model.Perm;
import com.zijie.rbac.model.Resource;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface PermMapper extends BaseMapper< Perm> {
    Page<Perm> findAll(Page<Perm> page, Perm perm);


    int assignResources(Integer permId, Integer[] resourceIds);



    List<Resource> resources(Integer permId);


    @Delete("delete from t_rbac_perm_resource where perm_id=#{permId} and resource_id=#{resourceId}")
    int deleteResources(Integer permId, Integer resourceId);
}
